package com.juc.cyclicbarrier.cyclicbarrier5;

import java.util.concurrent.CyclicBarrier;

public class Run {

	public static void main(String[] args) {
		int parties = 4;
		CyclicBarrier cbRef = new CyclicBarrier(parties, new Runnable() {
			
			@Override
			public void run() {
				System.out.println(" 都到了 ！");
				
			}
		});
		MyService myService = new MyService(cbRef);
		
		MyThread[] threadArray = new MyThread[4];
		for (int i = 0; i < threadArray.length; i++) {
			threadArray[i] = new MyThread(myService);
			threadArray[i].start();
		}
	}
}
